#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableShipTradeTaskDao:DaoBase<TableShipTradeTask>
    {
        public override string GetFileName()
        {
            return "TableShipTradeTask.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableShipTradeTask>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableShipTradeTask model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.tradeId)) UnityEngine.Debug.LogError("数据表id重复:TableShipTradeTask->id: " + model.tradeId);
            #endif
            cachePrimaryInt[model.tradeId] = model;
        }
        protected override TableShipTradeTask ParseRowData(string[] rowData)
        {
            TableShipTradeTask data = new TableShipTradeTask();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.tradeId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.name = string.Intern(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.icon = string.Intern(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.tradeType = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.worldMapId = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.quality = int.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.limit = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.addGold = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.costTime = long.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.voyage = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.tradeDesc = string.Intern(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.costFood = int.Parse(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.costRes = rowData[12];
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.infoVal = int.Parse(rowData[13]);
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.previewRewards = string.Intern(rowData[14]);
            }
            if (!string.IsNullOrEmpty(rowData[15]))
            {
                data.rewards = string.Intern(rowData[15]);
            }
            return data;
        }
    }
}
